Media Player widgets
Path: Widget Gallery> Media> Media Player
Use these widgets to play videos from a playlist. The video files can be stored on a USB drive, on the Flash card or an SD Card.
Two widgets are available: one includes a multimedia frame with buttons to play and stop the video, the other is a plain frame where the video is played without user control.
Parameter | Description |
---|---|
Media Player List |
Open Windows file browser for selecting video files to collect in the play list. Selected files will be downloaded to the HMI device together with the project. When a USB device or an SD Card has been selected, files must be placed in a subfolder “mediafiles” of the external memory media. Video files will be played according to filename alphabetical order. Ensure you have the commercial rights of the multimedia files. |
Loop Style |
Define how the video is played.
|
Note: The Media Player widget only works with some HMI devices (see "HMI devices capabilities"). It doesn’t work the HMI Client.
Note: You can have only one Media Player widget in a page.
Supported video encoding
Two groups of codecs are supported:
- DSP based video codecs
- Software video codecs
List of HMI devices that support the DSP (video hardware acceleration) is available on "HMI devices capabilities".
DSP video codecs
These include:
- H264 using AVI/MP4 container, CABAC off and Level 3 (suggested)
- MPEG4 using MP4 container
BSP v1.0.269 or greater is required
Software video codecs
This is only:
- Microsoft MPEG4 v3 using an AVI container.
Be aware that video performance are depending from the chosen resolution, bit rate and device capabilities. If video rendering is not smooth, try to reduce the resolution or the bit rate of your video.
The videos encoded with Microsoft MPEG4 v3 are not using the hardware acceleration and have more limitations. To prevent the videos from running jerky, a maximum resolution of 640x512 pixels and a bit rate of 1300 kb/s are suggested. In addition, the size of the Media Player widget used on the page should have the same size as the videos in the play list, in order to avoid up scaling and down scaling. Audio is not supported.
Converting a video
The FFMPEG (www.ffmpeg.org) can be used to convert a video into the correct codec supported from the HMI device. Using the folder structure of the below picture, the following batch file could be used to convert any video file.
Now you can open the converted video with a standard video player, such as Windows Media Player and check the quality. You can add the resulting video to the play list of the Media Player widget.
Note : The FFMPEG tool is not distributed with the JMobile Suite.
Using Media Player in JavaScript
The Media Player widget can be also referenced in JavaScript programs with the following syntax:
//get the mediaplayer widget.
var mediaWgt = page.getWidget('MediaPlayerWgt2');
//load the play list
mediaWgt.setProperty('medialist', '/Storage Card/demo_3.avi,/Storage Card/video1_3.avi');
// set the loopstyle 0 - noloop, 1 - loop one, 2- loop all, 3 - random
mediaWgt.setProperty('loopstyle', 2);
//start playing the first file.
mediaWgt.mediapath = '/Storage Card/demo_3.avi';
See "JavaScript " for details on how to work with JavaScript.